package com.java1412.utils;

import org.springframework.stereotype.Component;

/**
 * @author java1412
 * @since 2023-08-09 14:05:52
 */
@Component
public class GenerateCodeUtil {


    /**
     * 生成四位验证码
     *
     * @return
     */
    public String generateCode() {
        StringBuffer sb = new StringBuffer("");
        for (int i = 0; i < 4; i++) {
            int number = (int) (Math.random() * 10);
            sb.append(number + "");
        }
        return sb.toString();
    }
}
